<template>
  <div id="app">
    <!-- <Home></Home>;
    <Order></Order>;
    <Mine></Mine> -->
     <!-- //动画 -->
     <transition name="fade" mode="out-in">
         <keep-alive>
          <!-- 动态组件 -->
           <component :is="coms[currentIndex]"> </component>
         </keep-alive>
   </transition>


   <div class="tabbar">
     <span  :class="{active:currentIndex==index}" v-for="(item,index) in btns" :key="index" @click="currentIndex=index" 
    >{{item}}</span>
   </div>
    <!-- <div class="tabbar">
      <span :class="{active: currentIndex == index }" v-for="(item,index) in btns" :key="index" @click="currentIndex=index">{{item}}</span>
    </div> -->

  </div>
</template>

<script>
// import BBT from './components/BBT.vue';
import BBT from './components/BBT.vue';
import Home from './components/Home.vue';
import Order from './components/Order.vue';
import Mine from './components/Mine.vue';


export default {
   data(){
    return{
        currentIndex :0,
        btns:['首页','爆爆团','订单','我的'],
        coms:[Home,BBT,Order,Mine,],  
         }
   },
  components: {
    Home,
    Order,
    Mine,
    BBT

  }
}
</script>

<style lang="scss" scoped>
*{
  margin: 0;
  padding: 0;
}
.tabbar{
  display: flex;
  justify-content: space-around;
  align-content: center;
  padding: 10px 0;
  position: fixed;
  bottom: 0;
  width: 100%;
  box-sizing: border-box;
  border-top: 1px solid #ccc;
}
.tabbar .active{
  color: lightskyblue;
}

.fade-enter{
    transform: rotate(0deg);

}
.fade-enter-active{
transform: all 0.5s;
}
.fade-enter-to{
   transform: rotate(360deg);
}

//离场动画
.fade-leave{ // 动画开始时的状态
  // opacity: 1;
  // transform: scale(1) rotate(360deg);
  transform:  rotate(360deg);
}
.fade-leave-active{
  transition: all 0.2s;
}
.fade-leave-to{ // 动画结束时的状态
  // opacity: 0;
  // transform: scale(0) rotate(0deg);
  transform:  rotate(0deg);
}
</style>
